#ifndef __MYSTRING_H_
#define __MYSTRING_H_
#include <iostream>
class myStringList;
class myString
{
    friend myStringList;
    friend std::ostream &operator<<(std::ostream &os, const myString &str);
    friend std::istream &operator>>(std::istream &is, myString &str);

private:
    char *string;
    int size;
    int capacity;

public:
    /*无参构造*/
    myString();
    /*带参构造*/
    myString(const char *str);
    /*拷贝构造*/
    myString(const myString &str);
    /*析构函数*/
    ~myString();
    /*+号运算符重载*/
    myStringList split(const myString &token);
    myString operator+(const myString &str);
    myString operator-(const myString &str);
    /*=号运算符重载*/
    myString &operator=(const myString &str);
    myString &operator+=(const myString &str);
    myString &operator-=(const myString &str);
    bool operator==(const myString &str);
    bool operator!=(const myString &str);
    bool operator&&(const myString &str);
    char &operator[](int idx);
    operator int();
    operator double();
};
std::ostream &operator<<(std::ostream &os, const myString &str);
std::istream &operator>>(std::istream &is, myString &str);
std::ostream &operator<<(std::ostream &os, const myStringList &list);
class myStringList
{
    friend myStringList myString::split(const myString &token);
    friend std::ostream &operator<<(std::ostream &os, const myStringList &list);

public:
    myStringList();
    ~myStringList();
    myStringList &operator+=(const myString &str);
    myStringList &operator-=(const myString &str);
    myString &operator[](int idx);
    void removeByIndex(int idx);

private:
    int size;
    int capacity;
    myString *strList;
};
#endif //__MYSTRING_H_